using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using InfoExpress.HIV.WinApp.Utils;

namespace InfoExpress.HIV.WinApp.Popups
{
  public partial class FrmChonBaoCaoThang : XtraForm
  {
    private int _thang = 1;
    private int _nam = 2005;

    public FrmChonBaoCaoThang()
    {
      InitializeComponent();
    }

    #region Event Handlers

    private void FrmChonBaoCaoThang_Load(object sender, EventArgs e)
    {
      int value = _thang;
      while (value <= DateTime.Now.Month)
      {
        cboThang.Properties.Items.Add(value);
        value++;
      }

      value = _nam;
      while (value <= DateTime.Now.Year)
      {
        cboNam.Properties.Items.Add(value);
        value++;
      }
    }

    private void FrmChonBaoCaoThang_Enter(object sender, EventArgs e)
    {
      MainFormUtils.SetDefaultStatus();
    }

    #region Command Handlers

    private void btnSelect_Click(object sender, EventArgs e)
    {
      if (dxValidationProvider.Validate())
      {
        using (FrmBaoCaoThang frm =
          new FrmBaoCaoThang(string.Empty,
            (int)cboThang.SelectedItem,
            (int)cboNam.SelectedItem) { Owner = this })
        {
          frm.ShowDialog();
        }
      }
    }

    #endregion

    #endregion

  }
}